home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / selectiveCvsDisplay.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.9 KB  |  91 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  30 April 1998
  22. //
  23. //  Author:         mgr
  24. //
  25. //  Description:
  26. //      A function to hide/show the selected CVs on a nurbs surface. 
  27. //
  28.  
  29.  
  30. global proc selectiveCvsDisplay( int $hide )
  31. //
  32. //    $hide == 1 : hide the cvs that are not selected on the surface by turning 
  33. //    on the selective cv display attribute for the surface.
  34. //
  35. //    $hide == 0 : show all the cvs on the selected surface by turning off the
  36. //    selective cv display attribute for the surface.
  37. //
  38. {
  39.     // get the list of objects selected with CV components.
  40.     //
  41.     global int $gSelectCVsBit;
  42.     string $surfaceList[] = `filterExpand -ex false -sm $gSelectCVsBit`;
  43.     int $numSurfaces = size($surfaceList);
  44.     if ( $numSurfaces == 0 )
  45.     {
  46.         warning("No CVs on a NURBS surface selected.");
  47.         return;
  48.     }
  49.  
  50.     // from the items with CVs selected, get the name of the object only
  51.     // (ignoring the component) - this will also filter the list to 
  52.     // ignore duplicate items
  53.     //
  54.     $surfaceList = `ls -sl -o $surfaceList`;
  55.  
  56.     // now select the objects that had CVs selected and filter that list
  57.     // for nurbs surfaces only
  58.     //
  59.     global int $gSelectNurbsSurfacesBit;
  60.     $surfaceList = `filterExpand -ex false -sm $gSelectNurbsSurfacesBit $surfaceList`;
  61.     $numSurfaces = size($surfaceList);
  62.     if ( $numSurfaces == 0 )
  63.     {
  64.         warning("No CVs on a NURBS surface selected.");
  65.         return;
  66.     }
  67.  
  68.     // turn on/off the selective CV display for the nurbs surfaces
  69.     //
  70.     int $i;
  71.     int $isAlreadySelective;
  72.     for ( $i = 0; $i < $numSurfaces; $i++ )
  73.     {
  74.         // if setting the attribute on the surface to true/false but the 
  75.         // attribute is already true/false, then no need to do a setAttr again
  76.         //
  77.         $isAlreadySelective = eval("getAttr " + $surfaceList[$i] + ".scvd");
  78.         if ( $hide == $isAlreadySelective ) 
  79.         {
  80.             if ( $hide == 1 ) 
  81.               warning("Selective CV display is already on for this surface.");
  82.             else 
  83.               warning("Selective CV display is already off for this surface.");
  84.  
  85.             continue;
  86.         }
  87.  
  88.         eval("setAttr " + $surfaceList[$i] + ".scvd " + $hide);
  89.     }
  90. }
  91.